package design_pattern.singleton;

/**
 * Created by WeiDingKuo on 2017/10/26 9:35
 * <p>
 * 通过内部类，类加载机制，来实现对象的懒加载，并保证线程安全
 */
public class Singleton1 {
    private Singleton1() {
    }

    private static class SingletonHolder {
        private static final Singleton1 INSTANCE = new Singleton1();
    }

    public static final Singleton1 getInstance() {
        return SingletonHolder.INSTANCE;
    }
}
